package ooday04;

public class AnimalTest {
    public static void main(String[] args) {

        Animals[] animals=new Animals[4];
        Master master=new Master();
        animals[0]=new Dog("小黄",32,"黑色");
        animals[1]=new Dog("菲菲",2,"绿色");
        animals[2]=new Chick("坤哥",3,"黄色");
        animals[3]=new Fish("美人鱼",33,"五彩斑斓");
        for (int i=0;i<animals.length;i++){
            master.feed(animals[i]);
            animals[i].sayHi();

            /*if(animals[i] instanceof Dog){
                Dog b=(Dog) animals[i];
                b.swim();
            }*/
           if(animals[i] instanceof Swim){
                Swim a=(Swim) animals[i];
                a.swim();
            }

        }



      /*  Dog dog=new Dog("大黄",3,"黑色");
        dog.sayHi();
        dog.eat();
        dog.swim();

        Fish fish=new Fish("小金,",2,"金色");
        fish.sayHi();
        fish.eat();
        fish.swim();

        Chick chick=new Chick("鸡儿",2,"黑白色");
        chick.sayHi();
        chick.eat();*/
    }
}
